﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public DataRow Convert2GAAUF(DataRow dwInput, string ITXDBVERSION, bool IsConvert = false)
        {
            DataSet SResult = new DataSet();
            SResult = QueryGAAUF(dwInput, 0);
            DataRow dwReturn = null;
            if (SResult.Tables[0].Rows.Count > 0)
            {
                dwReturn = SResult.Tables[0].Rows[0];
            }
            else
            {
                dwReturn = SResult.Tables[0].NewRow();
            }
            switch (ITXDBVERSION)
            {
                case "YGR":
                    #region====YGR======
                    dwReturn["GAMANDANT"] = "00";
                    dwReturn["GAAUFKRS"] = "  ";
                    dwReturn["GAAUFLFD"] = "000000";
                    dwReturn["GAAUFPOS"] = "000";
                    dwReturn["GASA"] = "713";
                    dwReturn["GAPOS"] = "01";
                    dwReturn["GAAENDZL"] = "2";
                    dwReturn["GAAENDBEN"] = "        ";
                    dwReturn["GAAENDDAT"] = "00000000";
                    dwReturn["GANEUBEN"] = "        ";
                    dwReturn["GANEUDAT"] = "0";
                    dwReturn["GADATVON"] = "0";
                    dwReturn["GADATBIS"] = "0";
                    dwReturn["GADATVON1"] = "        ";
                    dwReturn["GADATBIS1"] = "        ";
                    dwReturn["GAART"] = "                    ";
                    dwReturn["GAVAR"] = "   ";
                    dwReturn["GAFARBE"] = "          ";
                    dwReturn["GAURVAR"] = "   ";
                    dwReturn["GADEZI"] = " ";
                    dwReturn["GAKG1"] = "0";
                    dwReturn["GASP1"] = "0";
                    dwReturn["GAKA1"] = "0";
                    dwReturn["GAKG2"] = "0";
                    dwReturn["GASP2"] = "0";
                    dwReturn["GAKA2"] = "0";
                    dwReturn["GAKG3"] = "0";
                    dwReturn["GASP3"] = "0";
                    dwReturn["GAKA3"] = "0";
                    dwReturn["GAKG4"] = "0";
                    dwReturn["GASP4"] = "0";
                    dwReturn["GAKA4"] = "0";
                    dwReturn["GAKG5"] = "0";
                    dwReturn["GASP5"] = "0";
                    dwReturn["GAKA5"] = "0";
                    dwReturn["GAKG6"] = "0";
                    dwReturn["GASP6"] = "0";
                    dwReturn["GAKA6"] = "0";
                    dwReturn["GAKG7"] = "0";
                    dwReturn["GASP7"] = "0";
                    dwReturn["GAKA7"] = "0";
                    dwReturn["GAABF"] = "0";
                    dwReturn["GAERLKZ"] = " ";
                    dwReturn["GADISPOKZ"] = " ";
                    dwReturn["GALO"] = "  ";
                    dwReturn["GALB"] = "  ";
                    dwReturn["GALP"] = "A       ";
                    dwReturn["GAAUFBKZ"] = " ";
                    dwReturn["GABEM"] = "                                        ";
                    dwReturn["GAVPEINH"] = "    ";
                    dwReturn["GAHUELSE"] = "      ";
                    dwReturn["GAANZBAUM"] = "00";
                    dwReturn["GASPUL"] = "0";
                    dwReturn["GALAENGE"] = "0";
                    dwReturn["GASPULGEW"] = "0";
                    dwReturn["GAAG"] = "  ";
                    dwReturn["GAPRODV"] = "  ";
                    dwReturn["GAAUFMSL"] = "  ";
                    dwReturn["GAKF"] = " ";
                    dwReturn["GAFDRES"] = " ";
                    dwReturn["GAWICKL"] = " ";
                    dwReturn["GASACHB"] = "        ";
                    dwReturn["GAANLO"] = "  ";
                    dwReturn["GAANLB"] = "  ";
                    dwReturn["GAANLP"] = "        ";
                    dwReturn["GAANAUFBKZ"] = " ";
                    dwReturn["GALIEFSCH"] = "        ";
                    dwReturn["GAFREIDAT"] = "0";
                    dwReturn["GAFREIBEN"] = "        ";
                    dwReturn["GALIEFNR"] = "        ";
                    dwReturn["GAMATKOMPDR"] = " ";
                    dwReturn["GAFUSSTEXT"] = "   ";
                    dwReturn["GAAFOLGE"] = "010";
                    dwReturn["GAAUFTRKZ"] = "G";
                    dwReturn["GABDEKZ"] = " ";
                    dwReturn["GABASMG2"] = "100000";
                    dwReturn["GABRUTTOKZ"] = " ";
                    dwReturn["GAERSATZ"] = " ";
                    dwReturn["GAURSA"] = "   ";
                    dwReturn["GAURPOS"] = "00";
                    dwReturn["GATLSA"] = "   ";
                    dwReturn["GATLPOS"] = "00";
                    dwReturn["GAINFOKZ"] = " ";
                    dwReturn["GADECKUNG"] = "G";
                    dwReturn["GAUSERZK"] = "        ";
                    dwReturn["GAVARKZ"] = " ";
                    dwReturn["GAZUKOMP"] = " ";
                    dwReturn["GAAFDLGS"] = "0";
                    dwReturn["GAAFDLGSZ"] = "0";
                    dwReturn["GAGESFDZ"] = "0";
                    dwReturn["GABEDFDZ"] = "0";
                    dwReturn["GAZLLG"] = "0";
                    dwReturn["GAABF2"] = "0";
                    dwReturn["GAZBEDKG"] = "0";
                    dwReturn["GAFILLER"] = " 000000000000                            ";
                    #endregion
                    break;
                case "JLT":
                    #region====JLT======
                    dwReturn["GAMANDANT"] = "00";
                    dwReturn["GAAUFKRS"] = "  ";
                    dwReturn["GAAUFLFD"] = "000000";
                    dwReturn["GAAUFPOS"] = "000";
                    dwReturn["GASA"] = "   ";
                    dwReturn["GAPOS"] = "  ";
                    dwReturn["GAAENDZL"] = "1";
                    dwReturn["GAAENDBEN"] = "        ";
                    dwReturn["GAAENDDAT"] = "00000000";
                    dwReturn["GANEUBEN"] = "        ";
                    dwReturn["GANEUDAT"] = "0";
                    dwReturn["GADATVON"] = "0";
                    dwReturn["GADATBIS"] = "0";
                    dwReturn["GADATVON1"] = "        ";
                    dwReturn["GADATBIS1"] = "        ";
                    dwReturn["GAART"] = "                    ";
                    dwReturn["GAVAR"] = "   ";
                    dwReturn["GAFARBE"] = "          ";
                    dwReturn["GAURVAR"] = "1  ";
                    dwReturn["GADEZI"] = " ";
                    dwReturn["GAKG1"] = "0";
                    dwReturn["GASP1"] = "0";
                    dwReturn["GAKA1"] = "0";
                    dwReturn["GAKG2"] = "0";
                    dwReturn["GASP2"] = "0";
                    dwReturn["GAKA2"] = "0";
                    dwReturn["GAKG3"] = "0";
                    dwReturn["GASP3"] = "0";
                    dwReturn["GAKA3"] = "0";
                    dwReturn["GAKG4"] = "0";
                    dwReturn["GASP4"] = "0";
                    dwReturn["GAKA4"] = "0";
                    dwReturn["GAKG5"] = "0";
                    dwReturn["GASP5"] = "0";
                    dwReturn["GAKA5"] = "0";
                    dwReturn["GAKG6"] = "0";
                    dwReturn["GASP6"] = "0";
                    dwReturn["GAKA6"] = "0";
                    dwReturn["GAKG7"] = "0";
                    dwReturn["GASP7"] = "0";
                    dwReturn["GAKA7"] = "0";
                    dwReturn["GAABF"] = "0";
                    dwReturn["GAERLKZ"] = " ";
                    dwReturn["GADISPOKZ"] = "V";
                    dwReturn["GALO"] = "01";
                    dwReturn["GALB"] = "ZZ";
                    dwReturn["GALP"] = "01      ";
                    dwReturn["GAAUFBKZ"] = " ";
                    dwReturn["GABEM"] = "                                        ";
                    dwReturn["GAVPEINH"] = "    ";
                    dwReturn["GAHUELSE"] = "      ";
                    dwReturn["GAANZBAUM"] = "00";
                    dwReturn["GASPUL"] = "10";
                    dwReturn["GALAENGE"] = "35";
                    dwReturn["GASPULGEW"] = "0";
                    dwReturn["GAAG"] = "  ";
                    dwReturn["GAPRODV"] = "  ";
                    dwReturn["GAAUFMSL"] = "  ";
                    dwReturn["GAKF"] = " ";
                    dwReturn["GAFDRES"] = " ";
                    dwReturn["GAWICKL"] = " ";
                    dwReturn["GASACHB"] = "        ";
                    dwReturn["GAANLO"] = "  ";
                    dwReturn["GAANLB"] = "  ";
                    dwReturn["GAANLP"] = "        ";
                    dwReturn["GAANAUFBKZ"] = " ";
                    dwReturn["GALIEFSCH"] = "        ";
                    dwReturn["GAFREIDAT"] = "0";
                    dwReturn["GAFREIBEN"] = "        ";
                    dwReturn["GALIEFNR"] = "        ";
                    dwReturn["GAMATKOMPDR"] = " ";
                    dwReturn["GAFUSSTEXT"] = "   ";
                    dwReturn["GAAFOLGE"] = "010";
                    dwReturn["GAAUFTRKZ"] = "A";
                    dwReturn["GABDEKZ"] = " ";
                    dwReturn["GABASMG2"] = "830";
                    dwReturn["GABRUTTOKZ"] = " ";
                    dwReturn["GAERSATZ"] = " ";
                    dwReturn["GAURSA"] = "   ";
                    dwReturn["GAURPOS"] = "00";
                    dwReturn["GATLSA"] = "   ";
                    dwReturn["GATLPOS"] = "00";
                    dwReturn["GAINFOKZ"] = " ";
                    dwReturn["GADECKUNG"] = " ";
                    dwReturn["GAUSERZK"] = "        ";
                    dwReturn["GAVARKZ"] = " ";
                    dwReturn["GAZUKOMP"] = " ";
                    dwReturn["GAAFDLGS"] = "0";
                    dwReturn["GAAFDLGSZ"] = "0";
                    dwReturn["GAGESFDZ"] = "0";
                    dwReturn["GABEDFDZ"] = "0";
                    dwReturn["GAZLLG"] = "0";
                    dwReturn["GAABF2"] = "0";
                    dwReturn["GAZBEDKG"] = "0";
                    dwReturn["GAFILLER"] = " 000000000000                            ";

                    #endregion
                    break;
            }
            if (IsConvert)
            {
                foreach (DataColumn cm in dwInput.Table.Columns)
                {
                    if (dwInput[cm.ColumnName].ToString() == "")
                        continue;
                    if (dwReturn.Table.Columns.Contains(cm.ColumnName))
                    {
                        dwReturn[cm.ColumnName] = dwInput[cm.ColumnName];
                    }
                }
            }
            return dwReturn;
        }
        public void MapGAAUF(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveGAAUF(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet setResult = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;

            setResult = QueryGAAUF(dwData, 1);
            if (setResult.Tables.Count > 0)
            {
                tbLocal = setResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapGAAUF(ref dwLocal, dwData);
            switch (ITXDBVERSION)
            {
                case "YGR":
                    if (!flgExist)
                    {
                        InsertGAAUF(dwLocal, 1);
                    }
                    UpdateGAAUF(dwLocal, 1);
                    break;
                default:
                    if (!flgExist)
                    {
                        InsertGAAUF(dwLocal, 1);
                    }
                    UpdateGAAUF(dwLocal, 1);
                    break;
            }

        }
        public void InsertGAAUF(DataRow dwData, int option = 1)
        {
            //GSCMANDANT  GSCART GSCVAR GSCFARBE
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "INSERT INTO GAAUF(GAMANDANT, GAAUFKRS, GAAUFLFD, GAAUFPOS, GASA, GAPOS, GAAENDZL, GAAENDBEN, GAAENDDAT, GANEUBEN, GANEUDAT, GADATVON, GADATBIS, GADATVON1, GADATBIS1, GAART, GAVAR, GAFARBE, GAURVAR, GADEZI, GAKG1, GASP1, GAKA1, GAKG2, GASP2, GAKA2, GAKG3, GASP3, GAKA3, GAKG4, GASP4, GAKA4, GAKG5, GASP5, GAKA5, GAKG6, GASP6, GAKA6, GAKG7, GASP7, GAKA7, GAABF, GAERLKZ, GADISPOKZ, GALO, GALB, GALP, GAAUFBKZ, GABEM, GAVPEINH, GAHUELSE, GAANZBAUM, GASPUL, GALAENGE, GASPULGEW, GAAG, GAPRODV, GAAUFMSL, GAKF, GAFDRES, GAWICKL, GASACHB, GAANLO, GAANLB, GAANLP, GAANAUFBKZ, GALIEFSCH, GAFREIDAT, GAFREIBEN, GALIEFNR, GAMATKOMPDR, GAFUSSTEXT, GAAFOLGE, GAAUFTRKZ, GABDEKZ, GABASMG2, GABRUTTOKZ, GAERSATZ, GAURSA, GAURPOS, GATLSA, GATLPOS, GAINFOKZ, GADECKUNG, GAUSERZK, GAVARKZ, GAZUKOMP, GAAFDLGS, GAAFDLGSZ, GAGESFDZ, GABEDFDZ, GAZLLG, GAABF2, GAZBEDKG, GAFILLER)"
    + " VALUES (:GAMANDANT, :GAAUFKRS, :GAAUFLFD, :GAAUFPOS, :GASA, :GAPOS, 10, 'INTEXE  ', '20080912', '92      ', '20080606', 0, 0, '        ', '        ', 'CO.NE.14.2          ', '1  ', '500014    ', '   ', '1', 10039, 0, 0, 10016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ' ', ' ', '  ', '  ', '        ', ' ', '                                        ', '    ', '      ', '00', 0, 0, 0, '  ', '  ', '  ', ' ', ' ', ' ', '        ', '  ', '  ', '        ', ' ', '        ', 0, '        ', '        ', ' ', '   ', '000', ' ', ' ', 0, ' ', ' ', '   ', '00', '   ', '00', ' ', ' ', '        ', ' ', ' ', 0, 0, 0, 0, 0, 0, 0, '                                         ')";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    setResult = Connect2Proxy(or1);
                    break;
                default:
                    break;
            }


        }
        public void DeleteGAAUF(string client, string krs, string lfd, string pos, int option = 1)
        {
            OracleCommand or1 = OracleDB.CreateCommand();

            switch (option)
            {
                case 1:
                    or1.CommandText = "DELETE GAAUF "
                + "  WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = client;
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = krs;
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = lfd;
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = pos;
                    break;
                case 2:
                    or1.CommandText = "DELETE GAAUF "
                + "  WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = client;
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = krs;
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = lfd;
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
        public void DeleteGAAUF(DataRow dwData, int option = 1)
        {
            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "DELETE GAAUF "
                        + "  WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GAPOS=:GAPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }

        public DataSet QueryGAAUF(DataRow dwData, int option = 1)
        {
            DataSet setReturn = new DataSet();
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            OracleCommand or1;

            or1 = OracleDB.CreateCommand();
            switch (option)
            {

                case 0:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  ROWNUM<2 ";
                    break;
                case 1:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  "
                            + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS"
                            + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                      ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    break;
                case 2:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS"
                        + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                      ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    break;
                case 3:
                    or1.CommandText = "SELECT M.*,GSHANDLNR,GSGARNBEZ FROM GAAUF M JOIN GSDAT ON GSART=GAART AND GSVAR=GAVAR WHERE GAKG3>0 AND GASA=713 AND "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD"
                        + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                      ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    break;
                case 4:
                    or1.CommandText = "SELECT DISTINCT GSCBEZ,GSHANDLNR,GSGARNBEZ,M.* FROM GAAUF M LEFT JOIN GSDAT ON GSART=GAART AND GSVAR=GAVAR LEFT JOIN GSCOLOR ON GSCART=GAART AND GSCVAR=GAVAR AND GSCFARBE=GAFARBE WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD"
                        + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                      ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    break;

                case 9:
                    or1.CommandText = "SELECT * FROM INTEX.GAAUF R WHERE NOT EXISTS"
                        + " (SELECT 1 FROM ICC_ABAUFM M  WHERE R.GAAUFKRS=M.ABAVKAUFKRS AND R.GAAUFLFD=M.ABAVKAUFLFD AND R.GAAUFPOS=M.ABAVKAUFPOS)"
                        + " AND GAMANDANT=:GAMANDANT AND GASA=:GASA AND GAKG2=0 AND GAKG3=0"
                    + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                      ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    break;
                case 5:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  "
                            + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GAPOS=:GAPOS"
                              + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS"
                        ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    break;
                case 6:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  GASA=713 AND "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD"
                           + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                        ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    break;
                case 7:
                    string ABKKDAUFTNR = dwData["ABKKDAUFTNR"].ToString().Trim();
                    or1.CommandText = "SELECT M.*,X.ABPWAKZ,ABPMANDANT,ABPAUFKRS,ABPAUFLFD,ABPAUFPOS,ABPSTKLG,P.ABPART,P.ABPVAR,P.ABPFARBE,ABPSOLLMENGE5,SUBSTR(ABKKDAUFTNR,1,7)||'             ' AS EXART,ABKKDAUFTNR,SUBSTR(GABEM,1,10) AS SPINLOT,SUBSTR(GABEM,11) AS SELLERNAME"
                        + " FROM GAAUF M JOIN ABKOPF ON ABKMANDANT=GAMANDANT AND ABKAUFKRS=GAAUFKRS AND ABKAUFLFD=GAAUFLFD"
                        + " JOIN ABPOS P ON ABPAUFKRS=GAAUFKRS AND ABPAUFLFD=GAAUFLFD AND ABPAUFPOS=GAAUFPOS"
                        + " LEFT JOIN ICC_ABAX X ON ABAAUFKRS=ABPAUFKRS AND ABAAUFLFD=ABPAUFLFD AND ABPAUFPOS=ABAAUFPOS"
                        + " WHERE  GASA=713 AND GAAUFKRS='JH'"
                        + " AND   GAMANDANT=:GAMANDANT AND ABKKDAUFTNR LIKE '%" + ABKKDAUFTNR + "%'"
                        + " ORDER BY P.ABPART,P.ABPVAR,P.ABPFARBE,X.ABPWAKZ,GAMANDANT,GAAUFKRS,GAAUFLFD,GAAUFPOS,GALO,GALB,GALP,GAART,GAVAR,GAFARBE,ABKKDAUFTNR";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    break;
                case 8:
                    or1.CommandText = "SELECT M.*,GAKG1-(GAKG3+GAKG5+GAKG2) AS GAKG0 FROM GAAUF M JOIN ABPOS ON ABPAUFKRS=GAAUFKRS AND ABPAUFLFD=GAAUFLFD AND ABPAUFPOS=GAAUFPOS "
                        + " WHERE GAMANDANT=:GAMANDANT AND GAART=:GAART   AND GAFARBE=:GAFARBE AND ABPERLKZ=' ' AND GASA=713 AND GAAUFKRS IN (" + dwData["C20"].ToString().Trim() + ") AND GAKG3+GAKG5+GAKG2<GAKG1";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 10:
                    or1.CommandText = "SELECT GAMANDANT,GAART,GAVAR,GAFARBE,GAAUFMSL,SUM(GAKG1) AS GAKG1,SUM(GAKG2) AS GAKG2,SUM(GAKG3) AS GAKG3,SUM(GAKG5) AS GAKG5, SUM(GAKG1-(GAKG3+GAKG5+GAKG2)) AS GAKG0 FROM GAAUF M JOIN ABPOS ON ABPAUFKRS=GAAUFKRS AND ABPAUFLFD=GAAUFLFD AND ABPAUFPOS=GAAUFPOS "
                        + " WHERE GAMANDANT=:GAMANDANT AND GAART=:GAART  AND GAFARBE=:GAFARBE AND ABPERLKZ=' ' AND GASA=713 AND GAAUFKRS IN (" + dwData["C20"].ToString().Trim() + ") AND GAKG3+GAKG5+GAKG2<GAKG1"
                        + " GROUP BY GAMANDANT,GAART,GAVAR,GAFARBE,GAAUFMSL";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 11:
                    or1.CommandText = "SELECT GAMANDANT,GAART,GAVAR,NVL(MAX(GSGARNBEZ),'  ') AS GSGARNBEZ,GAFARBE,GAAUFMSL,SUM(GAKG1) AS GAKG1,SUM(GAKG2) AS GAKG2,SUM(GAKG3) AS GAKG3,SUM(GAKG5) AS GAKG5, SUM(GAKG1-(GAKG3+GAKG5+GAKG2)) AS GAKG0 FROM GAAUF M JOIN ABPOS ON ABPAUFKRS=GAAUFKRS AND ABPAUFLFD=GAAUFLFD AND ABPAUFPOS=GAAUFPOS AND ABPPOSTYP=:ABPPOSTYP"
                        + " LEFT JOIN GSDAT ON GSART=GAART AND GSVAR=GAVAR "
                        + " WHERE GAMANDANT=:GAMANDANT AND ABPERLKZ=' ' AND GASA=713  AND GAKG3+GAKG5+GAKG2<GAKG1"
                        + " GROUP BY GAMANDANT,GAART,GAVAR,GAFARBE,GAAUFMSL"
                    + " ORDER BY GAART,GAVAR,GAFARBE,GAAUFMSL";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("ABPPOSTYP", OracleType.NVarChar).Value = dwData["C2"].ToString();
                    break;
                case 12://获取原料总库存
                    or1.CommandText = "SELECT MAX(GLBEM) AS GLBEM, GPGART AS GAART ,GPGVAR AS GAVAR,GPGFARBE AS GAFARBE,GPSPPART,GPFBPART,GLLO,GLLB, GLAUFMSL,GLLO AS LO,GLLB AS LB,'        ' AS LP,SUM(GLBSTKG*0.001) AS NETKG,0 AS QLOCK,0 AS QPLAN,SUM(GLBSTKG*0.001) AS QFREE FROM GLLG G JOIN GPDAT ON GPMANDANT=GLMANDANT AND  GPPARTIE=GLPARTIE"
                        + " WHERE GPMANDANT=:GAMANDANT AND GPGART=:GAART AND GPGFARBE= :GAFARBE AND RTRIM(GLLO||GLLB||GLLP) NOT LIKE'" + dwData["C20"].ToString().Trim() + "%'"
                        + " GROUP BY GPGART,GPGVAR,GPGFARBE,GPSPPART,GPFBPART,GLLO,GLLB,GLAUFMSL"
                        + " ORDER BY GPGART,GPGVAR,GPGFARBE,GPSPPART,GPFBPART,GLLO,GLLB,GLAUFMSL";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 121://获取原料总库存
                    or1.CommandText = "SELECT MAX(GLBEM) AS GLBEM, GPGART AS GAART ,GPGVAR AS GAVAR,GPGFARBE AS GAFARBE,GPSPPART,GPFBPART,GLLO,GLLB, GLAUFMSL,GLLO AS LO,GLLB AS LB, SUBSTR(GLLP,1,1) AS LP,SUM(GLBSTKG*0.001) AS NETKG,0 AS QLOCK,0 AS QPLAN,SUM(GLBSTKG*0.001) AS QFREE,'                      ' AS ADDT FROM GLLG G JOIN GPDAT ON GPMANDANT=GLMANDANT AND  GPPARTIE=GLPARTIE"
                        + " WHERE GPMANDANT=:GAMANDANT AND GPGART=:GAART AND GPGFARBE= :GAFARBE AND RTRIM(GLLO||GLLB||GLLP) LIKE'" + dwData["C20"].ToString().Trim() + "%'"
                        + " GROUP BY GPGART,GPGVAR,GPGFARBE,GPSPPART,GPFBPART,GLLO,GLLB,SUBSTR(GLLP,1,1),GLAUFMSL"
                        + " ORDER BY GPGART,GPGVAR,GPGFARBE,GPSPPART,GPFBPART,GLLO,GLLB,SUBSTR(GLLP,1,1),GLAUFMSL";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 13://获取已经留位的锁定数量
                    or1.CommandText = "SELECT GPGART AS GAART ,GPGVAR AS GAVAR,GPGFARBE AS GAFARBE,GPSPPART,GPFBPART,GLAUFMSL,GLLO AS LO,GLLB AS LB,GLLP AS LP,0 AS NETKG,SUM(ZUEINTKG*0.001) AS QLOCK,SUM(ZUENTNKG*0.001) AS QISSUE,0 AS QFREE,'                      ' AS ADDT "
                        + "  FROM GLLG M JOIN  GPDAT ON GPMANDANT=GLMANDANT AND  GPPARTIE=GLPARTIE JOIN ZUTEI ON ZULBEHI=GLLBEHI AND ZUERLKZ <> 'J'"
                        + " WHERE GPMANDANT=:GAMANDANT AND GPGART=:GAART AND GPGFARBE= :GAFARBE"
                        + " GROUP BY GPGART,GPGVAR,GPGFARBE,GPSPPART,GPFBPART,GLLO,GLLB,GLLP,GLAUFMSL ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 14://获取纺批预计的锁定数量
                    or1.CommandText = "SELECT GAART,GAVAR,GAFARBE,GABEM,GAAUFMSL,0 AS NETKG,SUM((GAKG1-GAKG3-GAKG5)*0.01) AS QPLAN,0 AS QFREE FROM  GAAUF "
                        + " WHERE GAKG1-GAKG2-GAKG3-GAKG5>0 AND GAMANDANT=:GAMANDANT AND GAART=:GAART  AND GAFARBE=:GAFARBE  AND GASA='713'"
                        + " GROUP BY GAART,GAVAR,GAFARBE,GABEM,GAAUFMSL ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    break;
                case 15:
                    or1.CommandText = "SELECT M.*,VKPLIEFTERM"
                        + ",VKPSACHBE,VKPKUNDNR,VKPVB,VKPVG,VKPLAEBIS,VKPLAEVON,VKPAUFMART"
                        + " FROM GAAUF M JOIN VKPOS ON"
                        + " GASA='610' AND GAAUFKRS=VKPAUFKRS AND GAAUFLFD=VKPAUFLFD AND GAAUFPOS=VKPAUFPOS AND VKPSA='  '"
                        + " WHERE VKPMANDANT=:VKPMANDANT  AND VKPAUFKRS=:VKPAUFKRS  AND VKPAUFLFD=:VKPAUFLFD";
                    or1.Parameters.Add("VKPMANDANT", OracleType.NVarChar).Value = dwData["VKPMANDANT"].ToString();
                    or1.Parameters.Add("VKPAUFKRS", OracleType.NVarChar).Value = dwData["VKPAUFKRS"].ToString();
                    or1.Parameters.Add("VKPAUFLFD", OracleType.NVarChar).Value = dwData["VKPAUFLFD"].ToString();
                    break;
                case 16:
                    or1.CommandText = "SELECT * FROM GAAUF WHERE  "
                            + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS"
                               + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                        ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    break;
                case 17://获取已经留位的锁定数量
                    or1.CommandText = "SELECT ZUAUFKRS,ZUAUFLFD,ZUAUFPOS,GLAUFMSL,GPSPPART,GPFBPART,SUM(ZUEINTKG*0.001) AS QLOCK,SUM(ZUENTNKG*0.001) AS QISSUE,0 AS QFREE"
                        + "  FROM GLLG M JOIN  GPDAT ON GPMANDANT=GLMANDANT AND  GPPARTIE=GLPARTIE JOIN ZUTEI ON ZULBEHI=GLLBEHI"
                        + " WHERE   GLLO=:GLLO AND GLLB=:GLLB AND GPGART=:GAART AND GPGFARBE= :GAFARBE AND GPSPPART=:GPSPPART AND GPFBPART=:GPFBPART AND GLAUFMSL=:GLAUFMSL "
                       + "GROUP BY ZUAUFKRS,ZUAUFLFD,ZUAUFPOS,GLAUFMSL,GPSPPART,GPFBPART"
                       + " ORDER BY ZUAUFKRS,ZUAUFLFD,ZUAUFPOS"
                        ;

                    or1.Parameters.Add("GLLO", OracleType.NVarChar).Value = dwData["GLLO"].ToString();
                    or1.Parameters.Add("GLLB", OracleType.NVarChar).Value = dwData["GLLB"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    or1.Parameters.Add("GPSPPART", OracleType.NVarChar).Value = dwData["GPSPPART"].ToString();
                    or1.Parameters.Add("GPFBPART", OracleType.NVarChar).Value = dwData["GPFBPART"].ToString();
                    or1.Parameters.Add("GLAUFMSL", OracleType.NVarChar).Value = dwData["GLAUFMSL"].ToString();
                    break;
                case 18://获取纺批预计的锁定数量
                    or1.CommandText = "SELECT GAAUFKRS,GAAUFLFD,GAAUFPOS,GABEM,GAAUFMSL,0 AS NETKG,(GAKG1-GAKG3-GAKG5)*0.01 AS QPLAN,0 AS QFREE FROM  GAAUF "
                        + " WHERE GAKG1-GAKG2-GAKG3-GAKG5>0   AND GAART=:GAART  AND GAFARBE=:GAFARBE  AND GASA='713' AND (RTRIM(GABEM)=RTRIM(:GPSPPART) OR RTRIM(GABEM)=RTRIM(:GPFBPART)) AND GAAUFMSL=:GLAUFMSL"
                           + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                        ;

                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    or1.Parameters.Add("GPSPPART", OracleType.NVarChar).Value = dwData["GPSPPART"].ToString();
                    or1.Parameters.Add("GPFBPART", OracleType.NVarChar).Value = dwData["GPFBPART"].ToString();
                    or1.Parameters.Add("GLAUFMSL", OracleType.NVarChar).Value = dwData["GLAUFMSL"].ToString();
                    break;
                case 19://通过织造单，找到对应的纬纱需求
                    or1.CommandText = "SELECT ABPMANDANT,ABPAUFKRS,ABPAUFLFD,ABPAUFPOS FROM  GAAUF JOIN ABPOS ON GAMANDANT=ABPMANDANT AND  ABPART=GAART AND ABPFARBE=GAFARBE  AND RTRIM(ABPVAR)=RTRIM(GAVAR)"
                        + " WHERE  GASA=733 AND  GAMANDANT=:GAMANDANT  AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["ABPMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["ABPAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["ABPAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["ABPAUFPOS"].ToString();
                    break;
                case 20://通过织造单，找到对应的经纱需求
                    or1.CommandText = "SELECT ABPMANDANT,ABPAUFKRS,ABPAUFLFD,ABPAUFPOS FROM  GAAUF JOIN ABPOS ON GAMANDANT=ABPMANDANT AND  ABPART=GAART AND ABPFARBE=GAFARBE  AND RTRIM(ABPVAR)=RTRIM(GAVAR)"
                        + " WHERE  GASA=723 AND  GAMANDANT=:GAMANDANT  AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["ABPMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["ABPAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["ABPAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["ABPAUFPOS"].ToString();
                    break;
                case 21:
                    or1.CommandText = "SELECT M.*,VKPLIEFTERM"
                        + ",VKPSACHBE,VKPKUNDNR,VKPVB,VKPVG,VKPLAEBIS,VKPLAEVON,VKPAUFMART"
                        + " FROM GAAUF M JOIN VKPOS ON"
                        + " GASA='610' AND GAAUFKRS=VKPAUFKRS AND GAAUFLFD=VKPAUFLFD AND GAAUFPOS=VKPAUFPOS AND VKPSA='  '"
                        + " WHERE VKPMANDANT=:VKPMANDANT  AND VKPAUFKRS=:VKPAUFKRS  AND VKPAUFLFD=:VKPAUFLFD AND VKPAUFPOS=:VKPAUFPOS";
                    or1.Parameters.Add("VKPMANDANT", OracleType.NVarChar).Value = dwData["VKPMANDANT"].ToString();
                    or1.Parameters.Add("VKPAUFKRS", OracleType.NVarChar).Value = dwData["VKPAUFKRS"].ToString();
                    or1.Parameters.Add("VKPAUFLFD", OracleType.NVarChar).Value = dwData["VKPAUFLFD"].ToString();
                    or1.Parameters.Add("VKPAUFPOS", OracleType.NVarChar).Value = dwData["VKPAUFPOS"].ToString();
                    break;
                case 99:
                    or1.CommandText = "SELECT GAAUFKRS,	GAAUFLFD,GAAUFPOS,GAART,GAVAR,GAFARBE,GAKG1,GAKG2,GAKG3,GAKG4,GAKG5,GAKG6,GAKG7"
                        + " FROM GAAUF WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD"
                         + " ORDER BY GAAUFKRS,GAAUFLFD,GAAUFPOS,GAPOS"
                        ;
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    break;
                default:
                    break;
            }
            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                tbLocal.TableName = "GAAUF";
            }

            setReturn.Merge(Result);
            return setReturn;
        }
        public void UpdateGAAUF(DataRow dwData, int option = 1)
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    #region====CASE 1=========
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                    + "GAAENDZL=:GAAENDZL,"
                    + "GAAENDBEN=:GAAENDBEN,"
                    + "GAAENDDAT=:GAAENDDAT,"
                    + "GANEUBEN=:GANEUBEN,"
                    + "GANEUDAT=:GANEUDAT,"
                    + "GADATVON=:GADATVON,"
                    + "GADATBIS=:GADATBIS,"
                    + "GADATVON1=:GADATVON1,"
                    + "GADATBIS1=:GADATBIS1,"
                    + "GAART=:GAART,"
                    + "GAVAR=:GAVAR,"
                    + "GAFARBE=:GAFARBE,"
                    + "GAURVAR=:GAURVAR,"
                    + "GADEZI=:GADEZI,"
                    + "GAKG1=:GAKG1,"
                    + "GASP1=:GASP1,"
                    + "GAKA1=:GAKA1,"
                    + "GAKG2=:GAKG2,"
                    + "GASP2=:GASP2,"
                    + "GAKA2=:GAKA2,"
                    + "GAKG3=:GAKG3,"
                    + "GASP3=:GASP3,"
                    + "GAKA3=:GAKA3,"
                    + "GAKG4=:GAKG4,"
                    + "GASP4=:GASP4,"
                    + "GAKA4=:GAKA4,"
                    + "GAKG5=:GAKG5,"
                    + "GASP5=:GASP5,"
                    + "GAKA5=:GAKA5,"
                    + "GAKG6=:GAKG6,"
                    + "GASP6=:GASP6,"
                    + "GAKA6=:GAKA6,"
                    + "GAKG7=:GAKG7,"
                    + "GASP7=:GASP7,"
                    + "GAKA7=:GAKA7,"
                    + "GAABF=:GAABF,"
                    + "GAERLKZ=:GAERLKZ,"
                    + "GADISPOKZ=:GADISPOKZ,"
                    + "GALO=:GALO,"
                    + "GALB=:GALB,"
                    + "GALP=:GALP,"
                    + "GAAUFBKZ=:GAAUFBKZ,"
                    + "GABEM=:GABEM,"
                    + "GAVPEINH=:GAVPEINH,"
                    + "GAHUELSE=:GAHUELSE,"
                    + "GAANZBAUM=:GAANZBAUM,"
                    + "GASPUL=:GASPUL,"
                    + "GALAENGE=:GALAENGE,"
                    + "GASPULGEW=:GASPULGEW,"
                    + "GAAG=:GAAG,"
                    + "GAPRODV=:GAPRODV,"
                    + "GAAUFMSL=:GAAUFMSL,"
                    + "GAKF=:GAKF,"
                    + "GAFDRES=:GAFDRES,"
                    + "GAWICKL=:GAWICKL,"
                    + "GASACHB=:GASACHB,"
                    + "GAANLO=:GAANLO,"
                    + "GAANLB=:GAANLB,"
                    + "GAANLP=:GAANLP,"
                    + "GAANAUFBKZ=:GAANAUFBKZ,"
                    + "GALIEFSCH=:GALIEFSCH,"
                    + "GAFREIDAT=:GAFREIDAT,"
                    + "GAFREIBEN=:GAFREIBEN,"
                    + "GALIEFNR=:GALIEFNR,"
                    + "GAMATKOMPDR=:GAMATKOMPDR,"
                    + "GAFUSSTEXT=:GAFUSSTEXT,"
                    + "GAAFOLGE=:GAAFOLGE,"
                    + "GAAUFTRKZ=:GAAUFTRKZ,"
                    + "GABDEKZ=:GABDEKZ,"
                    + "GABASMG2=:GABASMG2,"
                    + "GABRUTTOKZ=:GABRUTTOKZ,"
                    + "GAERSATZ=:GAERSATZ,"
                    + "GAURSA=:GAURSA,"
                    + "GAURPOS=:GAURPOS,"
                    + "GATLSA=:GATLSA,"
                    + "GATLPOS=:GATLPOS,"
                    + "GAINFOKZ=:GAINFOKZ,"
                    + "GADECKUNG=:GADECKUNG,"
                    + "GAUSERZK=:GAUSERZK,"
                    + "GAVARKZ=:GAVARKZ,"
                    + "GAZUKOMP=:GAZUKOMP,"
                    + "GAAFDLGS=:GAAFDLGS,"
                    + "GAAFDLGSZ=:GAAFDLGSZ,"
                    + "GAGESFDZ=:GAGESFDZ,"
                    + "GABEDFDZ=:GABEDFDZ,"
                    + "GAZLLG=:GAZLLG,"
                    + "GAABF2=:GAABF2,"
                    + "GAZBEDKG=:GAZBEDKG,"
                    + "GAFILLER=:GAFILLER "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";

                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAAENDZL", OracleType.NVarChar).Value = dwData["GAAENDZL"].ToString();
                    or1.Parameters.Add("GAAENDBEN", OracleType.NVarChar).Value = dwData["GAAENDBEN"].ToString();
                    or1.Parameters.Add("GAAENDDAT", OracleType.NVarChar).Value = dwData["GAAENDDAT"].ToString();
                    or1.Parameters.Add("GANEUBEN", OracleType.NVarChar).Value = dwData["GANEUBEN"].ToString();
                    or1.Parameters.Add("GANEUDAT", OracleType.NVarChar).Value = dwData["GANEUDAT"].ToString();
                    or1.Parameters.Add("GADATVON", OracleType.NVarChar).Value = dwData["GADATVON"].ToString();
                    or1.Parameters.Add("GADATBIS", OracleType.NVarChar).Value = dwData["GADATBIS"].ToString();
                    or1.Parameters.Add("GADATVON1", OracleType.NVarChar).Value = dwData["GADATVON1"].ToString();
                    or1.Parameters.Add("GADATBIS1", OracleType.NVarChar).Value = dwData["GADATBIS1"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAVAR", OracleType.NVarChar).Value = dwData["GAVAR"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    or1.Parameters.Add("GAURVAR", OracleType.NVarChar).Value = dwData["GAURVAR"].ToString();
                    or1.Parameters.Add("GADEZI", OracleType.NVarChar).Value = dwData["GADEZI"].ToString();
                    or1.Parameters.Add("GAKG1", OracleType.NVarChar).Value = dwData["GAKG1"].ToString();
                    or1.Parameters.Add("GASP1", OracleType.NVarChar).Value = dwData["GASP1"].ToString();
                    or1.Parameters.Add("GAKA1", OracleType.NVarChar).Value = dwData["GAKA1"].ToString();
                    or1.Parameters.Add("GAKG2", OracleType.NVarChar).Value = dwData["GAKG2"].ToString();
                    or1.Parameters.Add("GASP2", OracleType.NVarChar).Value = dwData["GASP2"].ToString();
                    or1.Parameters.Add("GAKA2", OracleType.NVarChar).Value = dwData["GAKA2"].ToString();
                    or1.Parameters.Add("GAKG3", OracleType.NVarChar).Value = dwData["GAKG3"].ToString();
                    or1.Parameters.Add("GASP3", OracleType.NVarChar).Value = dwData["GASP3"].ToString();
                    or1.Parameters.Add("GAKA3", OracleType.NVarChar).Value = dwData["GAKA3"].ToString();
                    or1.Parameters.Add("GAKG4", OracleType.NVarChar).Value = dwData["GAKG4"].ToString();
                    or1.Parameters.Add("GASP4", OracleType.NVarChar).Value = dwData["GASP4"].ToString();
                    or1.Parameters.Add("GAKA4", OracleType.NVarChar).Value = dwData["GAKA4"].ToString();
                    or1.Parameters.Add("GAKG5", OracleType.NVarChar).Value = dwData["GAKG5"].ToString();
                    or1.Parameters.Add("GASP5", OracleType.NVarChar).Value = dwData["GASP5"].ToString();
                    or1.Parameters.Add("GAKA5", OracleType.NVarChar).Value = dwData["GAKA5"].ToString();
                    or1.Parameters.Add("GAKG6", OracleType.NVarChar).Value = dwData["GAKG6"].ToString();
                    or1.Parameters.Add("GASP6", OracleType.NVarChar).Value = dwData["GASP6"].ToString();
                    or1.Parameters.Add("GAKA6", OracleType.NVarChar).Value = dwData["GAKA6"].ToString();
                    or1.Parameters.Add("GAKG7", OracleType.NVarChar).Value = dwData["GAKG7"].ToString();
                    or1.Parameters.Add("GASP7", OracleType.NVarChar).Value = dwData["GASP7"].ToString();
                    or1.Parameters.Add("GAKA7", OracleType.NVarChar).Value = dwData["GAKA7"].ToString();
                    or1.Parameters.Add("GAABF", OracleType.NVarChar).Value = dwData["GAABF"].ToString();
                    or1.Parameters.Add("GAERLKZ", OracleType.NVarChar).Value = dwData["GAERLKZ"].ToString();
                    or1.Parameters.Add("GADISPOKZ", OracleType.NVarChar).Value = dwData["GADISPOKZ"].ToString();
                    or1.Parameters.Add("GALO", OracleType.NVarChar).Value = dwData["GALO"].ToString();
                    or1.Parameters.Add("GALB", OracleType.NVarChar).Value = dwData["GALB"].ToString();
                    or1.Parameters.Add("GALP", OracleType.NVarChar).Value = dwData["GALP"].ToString();
                    or1.Parameters.Add("GAAUFBKZ", OracleType.NVarChar).Value = dwData["GAAUFBKZ"].ToString();
                    or1.Parameters.Add("GABEM", OracleType.NVarChar).Value = dwData["GABEM"].ToString();
                    or1.Parameters.Add("GAVPEINH", OracleType.NVarChar).Value = dwData["GAVPEINH"].ToString();
                    or1.Parameters.Add("GAHUELSE", OracleType.NVarChar).Value = dwData["GAHUELSE"].ToString();
                    or1.Parameters.Add("GAANZBAUM", OracleType.NVarChar).Value = dwData["GAANZBAUM"].ToString();
                    or1.Parameters.Add("GASPUL", OracleType.NVarChar).Value = dwData["GASPUL"].ToString();
                    or1.Parameters.Add("GALAENGE", OracleType.NVarChar).Value = dwData["GALAENGE"].ToString();
                    or1.Parameters.Add("GASPULGEW", OracleType.NVarChar).Value = dwData["GASPULGEW"].ToString();
                    or1.Parameters.Add("GAAG", OracleType.NVarChar).Value = dwData["GAAG"].ToString();
                    or1.Parameters.Add("GAPRODV", OracleType.NVarChar).Value = dwData["GAPRODV"].ToString();
                    or1.Parameters.Add("GAAUFMSL", OracleType.NVarChar).Value = dwData["GAAUFMSL"].ToString();
                    or1.Parameters.Add("GAKF", OracleType.NVarChar).Value = dwData["GAKF"].ToString();
                    or1.Parameters.Add("GAFDRES", OracleType.NVarChar).Value = dwData["GAFDRES"].ToString();
                    or1.Parameters.Add("GAWICKL", OracleType.NVarChar).Value = dwData["GAWICKL"].ToString();
                    or1.Parameters.Add("GASACHB", OracleType.NVarChar).Value = dwData["GASACHB"].ToString();
                    or1.Parameters.Add("GAANLO", OracleType.NVarChar).Value = dwData["GAANLO"].ToString();
                    or1.Parameters.Add("GAANLB", OracleType.NVarChar).Value = dwData["GAANLB"].ToString();
                    or1.Parameters.Add("GAANLP", OracleType.NVarChar).Value = dwData["GAANLP"].ToString();
                    or1.Parameters.Add("GAANAUFBKZ", OracleType.NVarChar).Value = dwData["GAANAUFBKZ"].ToString();
                    or1.Parameters.Add("GALIEFSCH", OracleType.NVarChar).Value = dwData["GALIEFSCH"].ToString();
                    or1.Parameters.Add("GAFREIDAT", OracleType.NVarChar).Value = dwData["GAFREIDAT"].ToString();
                    or1.Parameters.Add("GAFREIBEN", OracleType.NVarChar).Value = dwData["GAFREIBEN"].ToString();
                    or1.Parameters.Add("GALIEFNR", OracleType.NVarChar).Value = dwData["GALIEFNR"].ToString();
                    or1.Parameters.Add("GAMATKOMPDR", OracleType.NVarChar).Value = dwData["GAMATKOMPDR"].ToString();
                    or1.Parameters.Add("GAFUSSTEXT", OracleType.NVarChar).Value = dwData["GAFUSSTEXT"].ToString();
                    or1.Parameters.Add("GAAFOLGE", OracleType.NVarChar).Value = dwData["GAAFOLGE"].ToString();
                    or1.Parameters.Add("GAAUFTRKZ", OracleType.NVarChar).Value = dwData["GAAUFTRKZ"].ToString();
                    or1.Parameters.Add("GABDEKZ", OracleType.NVarChar).Value = dwData["GABDEKZ"].ToString();
                    or1.Parameters.Add("GABASMG2", OracleType.NVarChar).Value = dwData["GABASMG2"].ToString();
                    or1.Parameters.Add("GABRUTTOKZ", OracleType.NVarChar).Value = dwData["GABRUTTOKZ"].ToString();
                    or1.Parameters.Add("GAERSATZ", OracleType.NVarChar).Value = dwData["GAERSATZ"].ToString();
                    or1.Parameters.Add("GAURSA", OracleType.NVarChar).Value = dwData["GAURSA"].ToString();
                    or1.Parameters.Add("GAURPOS", OracleType.NVarChar).Value = dwData["GAURPOS"].ToString();
                    or1.Parameters.Add("GATLSA", OracleType.NVarChar).Value = dwData["GATLSA"].ToString();
                    or1.Parameters.Add("GATLPOS", OracleType.NVarChar).Value = dwData["GATLPOS"].ToString();
                    or1.Parameters.Add("GAINFOKZ", OracleType.NVarChar).Value = dwData["GAINFOKZ"].ToString();
                    or1.Parameters.Add("GADECKUNG", OracleType.NVarChar).Value = dwData["GADECKUNG"].ToString();
                    or1.Parameters.Add("GAUSERZK", OracleType.NVarChar).Value = dwData["GAUSERZK"].ToString();
                    or1.Parameters.Add("GAVARKZ", OracleType.NVarChar).Value = dwData["GAVARKZ"].ToString();
                    or1.Parameters.Add("GAZUKOMP", OracleType.NVarChar).Value = dwData["GAZUKOMP"].ToString();
                    or1.Parameters.Add("GAAFDLGS", OracleType.NVarChar).Value = dwData["GAAFDLGS"].ToString();
                    or1.Parameters.Add("GAAFDLGSZ", OracleType.NVarChar).Value = dwData["GAAFDLGSZ"].ToString();
                    or1.Parameters.Add("GAGESFDZ", OracleType.NVarChar).Value = dwData["GAGESFDZ"].ToString();
                    or1.Parameters.Add("GABEDFDZ", OracleType.NVarChar).Value = dwData["GABEDFDZ"].ToString();
                    or1.Parameters.Add("GAZLLG", OracleType.NVarChar).Value = dwData["GAZLLG"].ToString();
                    or1.Parameters.Add("GAABF2", OracleType.NVarChar).Value = dwData["GAABF2"].ToString();
                    or1.Parameters.Add("GAZBEDKG", OracleType.NVarChar).Value = dwData["GAZBEDKG"].ToString();
                    or1.Parameters.Add("GAFILLER", OracleType.NVarChar).Value = dwData["GAFILLER"].ToString();
                    #endregion
                    Connect2Proxy(or1);
                    break;
                case 2:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG2=:GAKG2 "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";

                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAKG2", OracleType.NVarChar).Value = dwData["GAKG2"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 3:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG2=GAKG3+GAKG5,GAKG3=0,GAKG5=0 "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 4:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG3=:GAKG3 ,GAKG5=:GAKG5,GAKG2=0,GAAUFMSL=:GAAUFMSL "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAART=:GAART AND GAVAR=:GAVAR AND GAFARBE=:GAFARBE";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAVAR", OracleType.NVarChar).Value = dwData["GAVAR"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    or1.Parameters.Add("GAAUFMSL", OracleType.NVarChar).Value = dwData["GAAUFMSL"].ToString();
                    or1.Parameters.Add("GAKG3", OracleType.NVarChar).Value = dwData["GAKG3"].ToString();
                    or1.Parameters.Add("GAKG5", OracleType.NVarChar).Value = dwData["GAKG5"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 5:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF X SET X.GABEM = NVL((SELECT MAX((CASE WHEN ZUART LIKE '1%' THEN DECODE(A.ZUFARBE,'000000    ',RPAD(B.GPSPPART,40,' '),RPAD(B.GPFBPART,40,' ')) ELSE RPAD(B.GPFBPART,40,' ') END)) FROM ZUTEI A,GPDAT B WHERE A.ZUMANDANT = B.GPMANDANT AND A.ZUPARTIE = B.GPPARTIE AND A.ZUPARTIEKZ = B.GPPARTIEKZ AND X.GAMANDANT =A.ZUMANDANT AND X.GAAUFKRS = A.ZUAUFKRS AND X.GAAUFLFD = A.ZUAUFLFD AND X.GAAUFPOS = A.ZUAUFPOS AND X.GASA = A.ZUSA AND X.GAPOS = A.ZUPOS ),RPAD(' ',40,' '))"
                       + " WHERE X.GAAUFKRS = :GAAUFKRS AND X.GAAUFLFD=:GAAUFLFD";
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    Connect2Proxy(or1);
                    break;

                case 6:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG2=:GAKG2 "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=610";

                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GAKG2", OracleType.NVarChar).Value = dwData["C20"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 7:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG1=:GAKG1,GAKG2=:GAKG2 "
                        + " WHERE  "
                         + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAKG1", OracleType.NVarChar).Value = dwData["GAKG1"].ToString();
                    or1.Parameters.Add("GAKG2", OracleType.NVarChar).Value = dwData["GAKG2"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 8:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG1=:GAKG1,GABASMG2=:GABASMG2 "
                        + " WHERE  "
                         + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAKG1", OracleType.NVarChar).Value = dwData["GAKG1"].ToString();
                    or1.Parameters.Add("GABASMG2", OracleType.NVarChar).Value = dwData["GABASMG2"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 9:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG1=:GAKG1,GABASMG2=:GABASMG2,GABEM=:GABEM "
                        + " WHERE  "
                         + "  GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=713";
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GABEM", OracleType.NVarChar).Value = dwData["C40"].ToString();
                    or1.Parameters.Add("GAKG1", OracleType.NVarChar).Value = dwData["C201"].ToString();
                    or1.Parameters.Add("GABASMG2", OracleType.NVarChar).Value = dwData["C20"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 10:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GAKG3=:GAKG3 ,GAKG5=:GAKG5,GAKG2=0,GAAUFMSL=:GAAUFMSL "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAAUFMSL", OracleType.NVarChar).Value = dwData["GAAUFMSL"].ToString();
                    or1.Parameters.Add("GAKG3", OracleType.NVarChar).Value = dwData["GAKG3"].ToString();
                    or1.Parameters.Add("GAKG5", OracleType.NVarChar).Value = dwData["GAKG5"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 11:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAKG5=(SELECT SUM(ZUEINTKG)/10 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA)"
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=610  AND GAPOS='01' AND EXISTS (SELECT 1 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA)";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 12:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAKG3=(SELECT SUM(ZUEINTKG)/10 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA AND GAPOS=ZUPOS AND ZUFLAG='S')"
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GASA=:GASA AND GAPOS=:GAPOS AND EXISTS (SELECT 1 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA AND GAPOS=ZUPOS AND ZUFLAG='S')";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    Connect2Proxy(or1);
                    UpdateGAAUF(dwData, 13);
                    break;
                case 13:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAKG5=(SELECT SUM(ZUEINTKG)/10 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA AND GAPOS=ZUPOS AND ZUFLAG='P')"
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GASA=:GASA AND GAPOS=:GAPOS AND EXISTS (SELECT 1 FROM ZUTEI Z WHERE GAAUFKRS=ZUAUFKRS AND ZUAUFLFD=GAAUFLFD AND GAAUFPOS=Z.ZUAUFPOS AND ZUSA=GASA AND GAPOS=ZUPOS AND ZUFLAG='P')";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 14:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAKG3=0,GAKG5=0"
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GASA=:GASA AND GAPOS=:GAPOS ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 15:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAART=:GAART,GAVAR=:GAVAR,GAFARBE=:GAFARBE "
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GASA=310 ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["ABPMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["ABPAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["ABPAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["ABPAUFPOS"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["ABPART"].ToString();
                    or1.Parameters.Add("GAVAR", OracleType.NVarChar).Value = dwData["ABPVAR"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["ABPFARBE"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 16:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET GAART=:GAART,GAVAR=:GAVAR,GAFARBE=:GAFARBE "
                        + " WHERE GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS  AND GASA=:GASA AND GAPOS=:GAPOS ";
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GAART", OracleType.NVarChar).Value = dwData["GAART"].ToString();
                    or1.Parameters.Add("GAVAR", OracleType.NVarChar).Value = dwData["GAVAR"].ToString();
                    or1.Parameters.Add("GAFARBE", OracleType.NVarChar).Value = dwData["GAFARBE"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 17:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                        + "GABEM=:GABEM "
                        + " WHERE  "
                        + "  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA AND GAPOS=:GAPOS";

                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString();
                    or1.Parameters.Add("GAPOS", OracleType.NVarChar).Value = dwData["GAPOS"].ToString();
                    or1.Parameters.Add("GABEM", OracleType.NVarChar).Value = dwData["GABEM"].ToString();
                    Connect2Proxy(or1);
                    break;
                case 18:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE GAAUF SET "
                         + "GABEM=REPLACE(GABEM,'*','-')    "
                         + " WHERE  GAMANDANT=:GAMANDANT AND GAAUFKRS=:GAAUFKRS AND GAAUFLFD=:GAAUFLFD AND GAAUFPOS=:GAAUFPOS AND GASA=:GASA "; 
                    or1.Parameters.Add("GAMANDANT", OracleType.NVarChar).Value = dwData["GAMANDANT"].ToString();
                    or1.Parameters.Add("GAAUFKRS", OracleType.NVarChar).Value = dwData["GAAUFKRS"].ToString();
                    or1.Parameters.Add("GAAUFLFD", OracleType.NVarChar).Value = dwData["GAAUFLFD"].ToString();
                    or1.Parameters.Add("GAAUFPOS", OracleType.NVarChar).Value = dwData["GAAUFPOS"].ToString();
                    or1.Parameters.Add("GASA", OracleType.NVarChar).Value = dwData["GASA"].ToString(); 
                    Connect2Proxy(or1);
                    break;
            }
        }
    }
}
